<template>
	<view class="pb50">
		<uni-card spacing="0" margin="0" :is-shadow="false" :border="false">
			<cforms ref="formsRef" :formData="formData" />
		</uni-card>
	</view>

	<view class="sticky-b10 p10">
		<button @click="submit" type="default" class="basicbutton m10" hover-class="basicbutton-hover">报名咨询</button>
	</view>

</template>

<script lang="ts" setup>
	import cforms from "./components/c-forms.vue";
	import { User } from "@/api/tables/User"
	import { getUser } from "@/utils/storage"
	import { onLoad } from '@dcloudio/uni-app'
	import { ref } from 'vue'

	let userData = ref<User>({})
	const formData = ref({
		receiveExpertId: '',
		receiveExpertName: '',
		consultationPurpose: '',
		concreteProblems: '',
		consultationTime: '',
		phone: '',
		studentId: '',
		jobseekerId: '',
		name: '',
		reservationStatus:  'NOT_PROCESSED'
	})
	let formsRef = ref(null)
	
	onLoad((option) => {
		let user = getUser()
		userData.value = user
		formData.value.receiveExpertId = option.itemID
		formData.value.receiveExpertName = option.name
		formData.value.phone = user.phonenumber
		formData.value.studentId = user.userId
		formData.value.jobseekerId = user.userId
		formData.value.name = user.name
	});

	function submit() {
		formsRef.value.formCheck()
	}
</script>

<style lang="scss" scoped>
	.forms-dom {
		background: #fff;
	}

	.sticky-b10 {
		position: sticky;
		bottom: 0rpx;
		background: #f5f5f5;
	}
</style>